<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateDriverWalletsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('driver_wallets', function (Blueprint $table) {
            $table->bigIncrements('id');
            $table->bigInteger('driver_id')->index()->comment('司机ID');
            $table->decimal('amount', 10, 2)->default(0)->comment('可提现金额');
            $table->decimal('settled_amount', 10, 2)->default(0)->comment('待结算');
            $table->decimal('balance', 10, 2)->default(0)->comment('余额');
            $table->timestamps();
        });
        \DB::statement("ALTER TABLE `driver_wallets` comment '司机钱包表'");
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('driver_wallets');
    }
}
